Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow multiple countries with same country code #2586

Conversation

roma-claudio
Copy link
Contributor

@roma-claudio roma-claudio commented Jun 28, 2024

Addresses SX-2130.

Purpose

We are currently using the country code phone prefix (e.g. +49) as unique identifier of the country code select/input field.
However, the phone prefix is not unique given a list of countries (e.g. Canada and U.S. share the same country code: +1)

This PR is changing the value that is hold by the country code input/select field from the phone prefix to the country ISO code (e.g. US)

Approach and changes

Adapted the service and the component logic to consider the country code and not the phone prefix as the source of truth for the country code input/select field

Definition of done

  • Development completed
  • Reviewers assigned
  • Unit and integration tests
  • Meets minimum browser support
  • Meets accessibility requirements

@roma-claudio roma-claudio self-assigned this Jun 28, 2024
Copy link

changeset-bot bot commented Jun 28, 2024

🦋 Changeset detected

Latest commit: 5592dc4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@sumup/circuit-ui Minor
@sumup/eslint-plugin-circuit-ui Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

This comment was marked as resolved.

Copy link

codecov bot commented Jun 28, 2024

Codecov Report

Attention: Patch coverage is 88.88889% with 2 lines in your changes missing coverage. Please review.

Project coverage is 86.75%. Comparing base (7fce1de) to head (5592dc4).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...i/components/PhoneNumberInput/PhoneNumberInput.tsx 88.23% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2586      +/-   ##
==========================================
- Coverage   86.76%   86.75%   -0.01%     
==========================================
  Files         210      210              
  Lines       12056    12065       +9     
  Branches     1520     1524       +4     
==========================================
+ Hits        10460    10467       +7     
- Misses       1543     1545       +2     
  Partials       53       53              
Files with missing lines Coverage Δ
...onents/PhoneNumberInput/PhoneNumberInputService.ts 84.84% <100.00%> (ø)
...i/components/PhoneNumberInput/PhoneNumberInput.tsx 89.81% <88.23%> (-0.53%) ⬇️

@roma-claudio roma-claudio changed the title SX-2130 Allow multiple countries with same country code and styling fixes SX-2130 Allow multiple countries with same country code Jul 1, 2024
@roma-claudio roma-claudio force-pushed the fix/input-phone-number-to-handle-mutliple-countries-with-same-code-and-styling branch from 15eb87d to ba02bb2 Compare July 5, 2024 14:48
@roma-claudio roma-claudio marked this pull request as ready for review July 5, 2024 14:58
@roma-claudio roma-claudio requested a review from a team as a code owner July 5, 2024 14:58
@roma-claudio roma-claudio requested review from connor-baer and removed request for a team July 5, 2024 14:58
Copy link

vercel bot commented Jul 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
oss-circuit-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 15, 2024 3:47pm

Copy link
Member

@connor-baer connor-baer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked whether there are any countries with multiple phone codes. There doesn't seem to be any, so it appears to be a many-to-one relationship between phone code and country code. In that case, it makes total sense to use the country code as the input value. Thanks for the pull request! 🙌🏻

Copy link
Contributor

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Add a comment explaining why the pull request is still relevant to prevent it from being closed.

@github-actions github-actions bot added stale and removed stale labels Sep 17, 2024
@connor-baer
Copy link
Member

@roma-claudio Do you want to address the review comments yourself, or would you mind if we take over the PR to finish it?

@roma-claudio
Copy link
Contributor Author

@roma-claudio Do you want to address the review comments yourself, or would you mind if we take over the PR to finish it?

@connor-baer - I'm planning to work on it this Friday.

If you have a urgent deadline to be met before that I'm happy with somebody else taking it over (as I don't have capacity before)

@roma-claudio
Copy link
Contributor Author

@connor-baer - I've accepted the suggested changes 👍🏻

Copy link
Member

@connor-baer connor-baer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for the contribution, @roma-claudio! I've added a changeset which means this is good to go.

@connor-baer connor-baer enabled auto-merge (squash) October 15, 2024 15:38
@connor-baer connor-baer changed the title SX-2130 Allow multiple countries with same country code Allow multiple countries with same country code Oct 15, 2024
@connor-baer connor-baer merged commit 708c52e into main Oct 15, 2024
13 of 15 checks passed
@connor-baer connor-baer deleted the fix/input-phone-number-to-handle-mutliple-countries-with-same-code-and-styling branch October 15, 2024 15:50
@connor-baer connor-baer mentioned this pull request Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants